Event¶
Overview¶
- Next Design Receive internal processing events and add your own functionality.
- By declaring the Next Design internal processing events to subscribe and associating an event handler with those events, you can execute your own processing in conjunction with the internal processing.
List of events that can be subscribed¶
Below is a list of events that you can subscribe to.
Please refer to Extension API Guide>Events for details of event parameters according to event type.
Application¶
-
Area name
application
-
event name
Event name Description onAfterStart Event after application startup onBeforeQuit Pre-application event -
Event parameters
Reference: Extension API Guide> Event
Project¶
-
Area name
project
-
event name
Event name Description onAfterNew Event after new project creation onBeforeOpen Pre-project opening event onAfterOpen Event after project opening onBeforeSave Pre-project event onAfterSave Event after project save onBeforeClose Pre-project event onAfterClose Event after project close onBeforeReload Project pre-reload event onAfterReload Project reload event -
Event parameter
Reference: Extension API Guide> Event
Model¶
-
Area name
models
-
event name
Event name Description onBeforeNew Event before model addition onAfterNew Event after model addition onFieldChanged Event after field value change onBeforeDelete Before model deletion event onBeforeChangeOwner Model parent before change event onAfterChangeOwner Event after model parent change onBeforeChangeOrder Event before model order change onAfterChangeOrder After model order change event onBeforeNewRelation Pre-related events onAfterNewRelation Related post-add event onValidate Event at model validation onError Event when error is added onModelEdited Model Editing Event onUndoRedo Undo Redo Event -
Event parameters
Reference: Extension API Guide> Event
Command¶
-
Area name
commands
-
event name
Event name Description onBeforeExecute Event before command execution onAfterExecute Event after command execution -
Subscribeable commands
-
Event parameters
Reference: Extension API Guide> Event
Editor¶
-
Area name
editors
-
event name
Event name Description onShow Editor display event onHide Editor Hidden Event onSelectionChanged Model selection event in editor -
Event parameter
Reference: Extension API Guide> Event
Page¶
-
Area name
pages
-
event name
Event name Description onBeforeChange Before page change event onAfterChange After page change event -
Event parameter
Reference: Extension API Guide> Event
Navigator¶
-
Area name
navigators
-
event name
Event name Description onShow Navigator display event onHide Navigator Hidden Event onSelectionChanged Model Selection Event in Navigator -
Event parameter
Reference: Extension API Guide> Event
Information window¶
-
Area name
informations
-
event name
Event name Description onShow Information window page display event onHide Information window page hidden event onSelectionChanged Information Window Page Display Element Selection Event onDoubleClick Information Window Page Display Element DoubleClick Event -
Event parameter
Reference: Extension API Guide> Event
Common events¶
- Events that you do not subscribe to do not need to be included in the manifest.
-
If you define the same event more than once in the manifest, the corresponding event will be valid in the following order of priority.
(1) Event for which the class name or target name is specified in the event filter value
(2) Event for which the fully qualified name of the class is specified in the event filter value (only for the model event filter)
(3) Event where the wildcard:*
is specified in the event filter value or the event filter is omittedFurthermore, if you define multiple events within the same priority, the first defined event will be valid.
-
If an event is duplicated and the event handler describes an empty event in the high priority event definition, the event will be unsubscribed. (Example:
"onAfterNew": ""
) - If multiple extensions subscribe to the same event, you cannot control the firing order of events between extensions. The firing order of events is the manifest loading order.
- If you subscribe to the same event with multiple extensions and cancel that event with one of the extensions, the remaining extensions will not fire the event.
Event filter¶
- For the model, you can filter the events to subscribe by specifying the class name (or the fully qualified name of the class) of the meta model as the value of the event filter.
- For the editor, you can narrow down the events to subscribe by specifying the view definition name in the value of the event filter.
- For the information window, you can filter the events to subscribe by specifying the page name as the value of the event filter.
- By using this event filter mechanism to narrow down the subscribed events, it is possible to avoid unnecessary event handlers being called for unnecessary events and slowing down the response.
Model event filter¶
- By specifying the class name in the meta model of the target model in the class property, you can subscribe to events only in the model of a specific class.
- You can specify the fully qualified name of the class instead of the class name.
- When targeting multiple classes, specify the class names separated by commas.
- If you specify the wildcard:
*
for the value or omit the property, you can subscribe to the event common to all models. - You cannot specify the inheritance source class name. You must specify the model class name.
Editor event filter¶
- By specifying the target view definition name in the viewDefinition property, you can subscribe to the event only in a specific view definition.
- When multiple view definitions are targeted, specify the view definition names separated by commas.
Navigator event filter¶
- By specifying the target navigator name in the navigator property, you can subscribe to events only in a specific navigator.
- You can specify the following values for the target navigator name.
Model
: Model navigatorProductLine
: Product line navigatorScm
: Configuration management navigatorProject
: Project navigatorProfile
: Profile navigator
- If you specify the wildcard:
*
for the value or omit the property, you can subscribe to the event in all navigators. - When targeting multiple navigators, specify the navigator names separated by commas.
Event filter in info window¶
- By specifying the target page name in the information property, you can subscribe to events only on a specific page.
- The following values can be specified as the target page name.
Error
: Error pageSearchResult
: Search result pageOutput
: Output page
- If you specify the wildcard:
*
for the value or omit the property, you can subscribe to the event on all pages. - When targeting multiple pages, specify page names separated by commas.
Event definition example¶
In the following example, the event that is not subscribed (event with empty event handler) is also described, but it is not actually necessary to describe.
{
"name": "Manifest Test",
"main": "main.cs",
"lifecycle": "project",
"extensionPoints":
{
"events":
{
"application":
{
"onAfterStart": "",
"onBeforeQuit": ""
},
"proejct":
{
"onAfterNew": "",
"onBeforeOpen": "",
"onAfterOpen": "",
"onBeforeSave": "ProjectOnBeforeSave",
"onAfterSave": "",
"onBeforeClose": "",
"onAfterClosee": "",
"onBeforeReload": "",
"onAfterReload": ""
},
"models":
[
{
"class": "*",
"onBeforeNew": "",
"onAfterNew": "AllModel_OnNew",
"onFieldChanged": "",
"onBeforeDelete": "",
"onBeforeChangeOwner": "",
"onAfterChangeOwner": "",
"onBeforeChangeOrder": "",
"onAfterChangeOrder": "",
"onBeforeNewRelation": "",
"onAfterNewRelation": "",
"onValidate": "",
"onError": "AllModel_OnError"
},
{
"class": "UseCase",
"onAfterNew": "UseCase_OnNew",
"onFieldChanged": "UseCase_OnFieldChanged",
"onBeforeDelete": "UseCase_OnBeforeDelete",
"onValidate": "UseCase_OnValidate",
"onError": ""
},
{
"class": "AnalysisFunctionType,SoftwareFunctionType",
"onAfterNew": "FunctionType_OnNew"
}
],
"commands":
[
{
"commandId": "myExtension.createBlock",
"onBeforeExecute": "CommandOnBeforeCreateBlock",
"onAfterExecute": ""
},
{
"commandId": "myExtension.updateBlock",
"onBeforeExecute": "",
"onAfterExecute": "CommandOnAfterUpdateBlock"
}
],
"editors":
[
{
"viewDefinition": "*",
"onShow": "",
"onHide": "",
"onSelectionChanged": ""
},
{
"viewDefinition": "logicalFunctionDiagaram",
"onShow": "",
"onHide": "",
"onSelectionChanged": ""
},
{
"viewDefinition": "logicalFunctionDetailForm",
"onShow": "",
"onSelectionChanged": ""
}
],
"pages":
{
"onBeforeChange": "",
"onAfterChange": ""
},
"navigators":
[
{
"navigator": "Model",
"onShow": "",
"onHide": "",
"onSelectionChanged": ""
},
{
"navigator": "Profile",
"onShow": "",
"onHide": "",
"onSelectionChanged": ""
}
],
"informations":
[
{
"information": "*",
"onShow": "",
"onHide": "",
"onSelectionChanged": "",
"onDoubleClick": ""
}
]
},
"commands": [
{
"id": "myExtension.createBlock",
"execFunc": "createBlock"
},
{
"id": "myExtension.updateBlock",
"execFunc": "updateBlock"
},
{
"id": "myExtension.generateCode",
"execFunc": "generateCode"
}
]
}
}
Example of event handler implementation¶
public void ProjectOnBeforeSave(IEventContext context, IEventParams eventParams)
{
var projectBeforeSaveEventParams = eventParams as ProjectBeforeSaveEventParams;
if (( projectBeforeSaveEventParams != null) && (projectBeforeSaveEventParams.Project.Name == "temporary" ))
{
projectBeforeSaveEventParams.Cancel();
}
}
Reference
- For more information on event parameters depending on the event type, see Extension API Guide> Event.